// 获取光标
export const getRangeAt = (el?: any): any => {
  // 初始化光标的位置
  let rangeAt: any = null
  // 获取选定对象
  // const doc = el.ownerDocument || el.document;
  // const win = doc.defaultView || doc.parentWindow;
  const selection: any = window.getSelection && window.getSelection()
  // 设置最后光标对象
  if (selection && selection.rangeCount) {
    rangeAt = selection.getRangeAt(0)
  } else {
    rangeAt = null
  }
  return rangeAt
}
